package java_regex;

public class HelloWorld {
	
	public static void main(String[] args) {
		System.out.println("abcdefg".matches("abc"));
		System.out.println("abcde".matches("abc"));
		System.out.println("abc".matches("abc"));
		
		System.out.println("abc".matches("ab"));
		System.out.println("abc".matches("bc"));
		System.out.println("abc".matches("abc"));
		
		// A dot matches any single character
		
		System.out.println("abc".matches("ab."));
		System.out.println("abc".matches("a.."));
		System.out.println("abc".matches(".."));
		System.out.println("abc".matches("..."));
		
		// [abc] means "any single character that is either a, b or c"
		
		System.out.println("True".matches("[tT]rue"));
		System.out.println("true".matches("[tT]rue"));
		System.out.println("True".matches("[t]rue"));
		System.out.println("true".matches("[t]rue"));
		
		
		
		// An asterisk matches zero or more of the preceding character
		
		System.out.println("aaaaabc".matches("a*bc"));
		System.out.println("aaaaabc".matches(".*"));
		//System.out.println("aaaaabc".matches("*")); Exception
		System.out.println("abcAnything123".matches("abc.*"));
		System.out.println("abcAnything123".matches("abc.*12"));
		System.out.println("abcAnything123".matches("abc.*123"));
		
	}

}
